package concurrent;

import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;

public class FutureTest2 {
    public static void main(String[] args) throws ExecutionException, InterruptedException {
        ExecutorService executorService = Executors.newCachedThreadPool();
        Future<Object> hahaha = executorService.submit(() -> {
            if (true) {
                throw new IllegalStateException("hahaha");
            }
            return null;
        });
        Object o = hahaha.get();
        System.out.println("result: " + o);
    }
}
